The present invention relates to a method of detecting two-dimensional codes, in particular matrix codes, which include a plurality of light and dark data bits arranged two-dimensionally, in particular in matrix form, wherein the code is detected as a gray scale value image, the detected gray scale value image is split up into image areas corresponding to the individual data bits, a binarizing threshold representing a specific gray scale value is defined for the image areas, binarizing of the gray scale value of the individual image areas is carried out in each case by means of the binarizing threshold to produce a bit sequence representing the data bits and consisting of the values 0 and 1, and the bit sequence is supplied to an error correction algorithm for the detection and/or correction of bit errors within the bit sequence.
The codes are two-dimensional, chessboard-like codes which have been optimized for electronic reading and which are generally termed matrix codes in this application. In the sense of the present application, however, all possible two-dimensional codes come under this heading even if they are not made in matrix form. These codes, which can be present both in square and rectangular form, or in any other two-dimensional arrangement, usually include an implicit error correction process which also allows a decoding in the event of partly destroyed or masked codes by means of localization and correction of the defective data bits. In this connection, the individual code elements of the matrix code are termed data bits, which are usually formed by white and black square or rectangular areas and which correspond to the bars and intermediate spaces in the one-dimensional barcode. The data bits can generally also have a shape deviating from the rectangular shape.
Whereas the known methods for detecting and recognizing the codes have a relatively high decoding reliability when the matrix codes present are error-free, these methods have problems in decoding in particular with codes with low contrast or with poorly printed codes. If too many data bits are incorrectly recognized due to the poor original, an error correction, and thus a decoding of the matrix code, is not possible.